package com.mezz.bones.framework.outbox.model;

import lombok.Data;

/**
 * @Author: zhuang
 * @Date: 2025/4/29 9:43
 * @Description: TODO
 * @Version: 1.0
 **/

@Data
public class ExecuteResult {

    private boolean success;
    private String code;
    private String message;
    private String errorStack;
    private Object data;

    public static ExecuteResult ok(Object data) {
        ExecuteResult result = new ExecuteResult();
        result.setSuccess(true);
        result.setCode("200");
        result.setMessage("success");
        result.setData(data);
        return result;
    }

    public static ExecuteResult error(String message) {
        ExecuteResult result = new ExecuteResult();
        result.setSuccess(false);
        result.setCode("500");
        result.setMessage(message);
        result.setErrorStack("");
        result.setData(message);
        return result;
    }

    public static ExecuteResult error(String message, String errorStack) {
        ExecuteResult result = new ExecuteResult();
        result.setSuccess(false);
        result.setCode("500");
        result.setMessage(message);
        result.setErrorStack(errorStack);
        result.setData(message);
        return result;
    }
}
